/**
 * 
 */
package pits.dao;

import junit.framework.Assert;
import junit.framework.TestCase;
import pits.dto.CompanyDTO;
import pits.dto.DepartexpDTO;
import pits.dto.DepartmentDTO;
import pits.form.EditTakenCompanyInfoForm;
//import pits.form.EditTakenCompanyInfoForm;
import java.util.ArrayList;
import java.util.List;
/**
 * @author ltd
 *
 */
public class EditTakenCompanyInfoDAOTest extends TestCase {

	/**
	 * Test method for {@link pits.dao.EditTakenCompanyInfoDAO#getEmployeeExp(int)}.
	 */
	public void testGetEmployeeExps1() {
		List<DepartexpDTO> result = new ArrayList<DepartexpDTO>();
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		result = dao.getDepartexps(1);
		Assert.assertNotSame("[]", result.toString());
	}
	public void testGetEmployeeExps2() {
		List<DepartexpDTO> result = new ArrayList<DepartexpDTO>();
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		result = dao.getDepartexps(1);
		Assert.assertNotSame("[]", result.toString());
	}
	public void testGetEmployeeExps3() {
		List<DepartexpDTO> result = new ArrayList<DepartexpDTO>();
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		result = dao.getDepartexps(0);
		Assert.assertEquals("[]", result.toString());
	}
	public void testGetEmployeeExps4() {
		List<DepartexpDTO> result = new ArrayList<DepartexpDTO>();
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		result = dao.getDepartexps(-1);
		Assert.assertEquals("[]", result.toString());
	}
	public void testGetDepartmentList1() {
		int size;
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		size = dao.getDepartmentList(1).size();
		Assert.assertEquals(9, size);
	}
	public void testSetDepartments() {
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		List<DepartmentDTO> dtos = dao.getDepartmentList(1);
		CompanyDTO dto = new CompanyDTO();
		try {
			for (int i = 0; i < dtos.size(); i++) {
				new pits.util.Logger().writeln("" + dtos.get(i).getDepartID());
			}
			dto.setDepartments(dtos);
			System.out.print(dto.getDepartments().size());
			for (int i = 0; i < dto.getDepartments().size(); i++) {
				new pits.util.Logger().writeln(dto.getDepartments().get(i).getDepartName());
			}
			Assert.assertEquals(9, dto.getDepartments().size());
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}
	public void testUpdate1() {
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		EditTakenCompanyInfoForm form = new EditTakenCompanyInfoForm();
		form.setDepartID(19);
		form.setStartDate("01-01-2008");
		form.setEndDate("31-12-2008");
		form.setRole("role_2");
		form.setDescription("description 1");
		List<DepartexpDTO> dtos = dao.updateTakenCompanyInfo(form, 19, 1);
		Assert.assertEquals(1, dtos.size());
	}
	public void testDelete1() {
		EditTakenCompanyInfoDAO dao = new EditTakenCompanyInfoDAO();
		String str = "20";
		List<DepartexpDTO> dtos = dao.deleteTakenCompanyInfo(str, 1);
		Assert.assertEquals(1, dtos.size());
	}
}
